package com.yzt.dynamicmodule.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.yzt.plugin_widget.RoundImageView;
import com.yzt.zhuju.network.entity.dynamic.GameScriptBean;
import com.yzt.dynamicmodule.R;
import com.yzt.zhuju.widget.widget.ImageLoadManger;

/**
 * author : bob
 * date   : 2023/2/27
 * desc   : 动态的适配器
 */
public class GameScriptAdapter extends BaseQuickAdapter<GameScriptBean, BaseViewHolder> implements LoadMoreModule {

    private boolean isHost;

    public void setHost(boolean host) {
        isHost = host;
    }

    public GameScriptAdapter() {
        super(R.layout.item_game_script);
    }

    @Override
    protected void convert(BaseViewHolder holder, GameScriptBean item) {
        RoundImageView imgHeader = holder.findView(R.id.img_cover);
        ImageLoadManger.loadIv(getContext(), item.getCover(), imgHeader, R.mipmap.default_photo);
        holder.setText(R.id.tv_name, item.getTitle())
                .setText(R.id.tv_time, item.getSuggestDuration() + "小时")
                .setText(R.id.tv_people, item.getSuggestPeopleNum() + "人")
                .setText(R.id.tv_desc, item.getDsc())
                //.setVisible(R.id.img_check, isHost)
                .setImageResource(R.id.img_check, item.isChecked() ? R.mipmap.icon_game_script_check : R.mipmap.icon_game_script_uncheck);
    }
}